//
//  NoticeListTableViewCell.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/11/8.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "NoticeListTableViewCell.h"
#import "JTCSM.h"

static CGFloat space = 20;
static CGFloat top = 10;
static CGFloat timeLableheight = 40;
@interface NoticeListTableViewCell ()

@property (nonatomic,strong) UILabel *timeLabel;
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UILabel *contentLabel;

@end

@implementation NoticeListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
        self.timeLabel = [UILabel initWithFrame:CGRectMake(0, 0, KSCREENWidth, timeLableheight) text:@"" font:16 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:RGBACOLOR(241, 241, 241, 1)];
        [self.contentView addSubview:self.timeLabel];
        
        self.titleLabel = [UILabel initWithFrame:CGRectZero text:@"" font:15 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(133, 133, 133, 1) backgroundColor:nil];
        [self.contentView addSubview:self.titleLabel];
        
        self.contentLabel = [UILabel initWithFrame:CGRectZero text:@"" font:15 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(133, 133, 133, 1) backgroundColor:nil];
        [self.contentView addSubview:self.contentLabel];
        
        self.titleLabel.numberOfLines = 0;
        self.contentLabel.numberOfLines = 0;

    }
    
    return self;
}

- (void)setvalueWithNoticeModel:(NoticeModel *)model{
    if (model == nil) {
        return;
    }
    
    self.timeLabel.text = model.create_time;
    
    CGRect rect = [df labelHeightWithContent:model.title width:KSCREENWidth-2*space font:15];
    self.titleLabel.text = model.title;
    self.titleLabel.frame = CGRectMake(space, KVIEW_Y(self.timeLabel)+top, KSCREENWidth-2*space, rect.size.height);
    
    CGRect rect1 = [df labelHeightWithContent:model.directions width:KSCREENWidth-2*space font:15];
    self.contentLabel.text = model.directions;
    self.contentLabel.frame = CGRectMake(space, KVIEW_Y(self.titleLabel)+top, KSCREENWidth-2*space, rect1.size.height+20);
}

@end
